<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>编辑商品</title>
    <link type="text/css" rel="stylesheet" href="/static/css/style.css" />
    <style type="text/css">
      h1 {
        text-align: center;
        margin-top: 200px;
      }

      h1 a {
        color: red;
      }

      input {
        text-align: center;
      }
    </style>
  </head>
  <body>
    <div id="header">
      <img class="logo_img" alt="" src="/static/img/logo.gif" />
      <span class="wel_word">编辑商品</span>
      <div>
        <a href="/getPageBooks">商品管理</a>
        <a href="/getOrders">订单管理</a>
        <a href="/">返回商城</a>
      </div>
    </div>

    <div id="main">
      <form action="/updateOrAddBook" method="POST">
        <table align="center">
          <tr>
            <td>名称</td>
            <td>价格</td>
            <td>作者</td>
            <td>销量</td>
            <td>库存</td>
            <td colspan="2">操作</td>
          </tr>
          <tr>
            {{if .}}
            <input type="hidden" name="bookId" value="{{.ID}}" />
            <td><input name="title" type="text" value="{{.Title}}" /></td>
            <td><input name="price" type="text" value="{{.Author}}" /></td>
            <td><input name="author" type="text" value="{{.Price}}" /></td>
            <td><input name="sales" type="text" value="{{.Sales}}" /></td>
            <td><input name="stock" type="text" value="{{.Stock}}" /></td>
            {{else}}
            <td><input name="title" type="text" /></td>
            <td><input name="price" type="text" /></td>
            <td><input name="author" type="text" /></td>
            <td><input name="sales" type="text" /></td>
            <td><input name="stock" type="text" /></td>
            {{end}}
            <td><input type="submit" value="提交" /></td>
          </tr>
        </table>
      </form>
    </div>

    <div id="bottom">
      <span> Copyright © 2007-2020 书文 版权所有 </span>
      <span> 京ICP备15025412号-2 京ICP备15025412-4号 </span>
      <span> 24小时客服电话微信15010729356 </span>
    </div>
  </body>
</html>
